Skip to main content

Storing Assets

When you store an asset, the asset and it's metadata are stored in your object store and database, respectively. There are two ways to store an asset:

  1. Multipart Upload: Use this when the asset content is available locally.
  2. URL Source: Use this when the asset content must be downloaded by Konifer from an external URL.

The URL structure for both is:

POST /assets/{your/defined/path}

The difference is how the content is supplied. Only one method is allowed per request.

Multipart Upload

A multipart upload lets you specify the asset content and metadata in the same request.

Part NameContent-TypePurposeRequired?
metadataapplication/jsonA JSON body containing custom, user-defined data about the assetYes (but may be empty{})
assetImage MIME type (e.g., image/jpeg)The raw binary content of the file being stored.Yes

Metadata JSON structure

The structure for the metadata part is (no fields are required):

{
"alt": "The alt text for an image",
"labels": {
"label-key": "label-value",
"phone": "Android"
},
"tags": [ "cold", "verified" ]
}
Field NameTypeDescriptionRequired
altStringThe supplied alt text of your assetNo
labelsObjectSupplied key-value pairs associated with the assetNo
tagsArraySupplied attributes associated with the assetNo

URL Source

Instead of supplying the file contents directly, you can specify a URL that Konifer downloads the asset content from. The request is identical to the multipart metadata, but you must add a url to the request:

{
"url": "https://yoururl.com/image.jpeg",
"alt": "The alt text for an image",
"labels": {
"label-key": "label-value",
"phone": "Android"
},
"tags": [ "cold", "verified" ]
}
Field NameTypeDescriptionRequired
altStringThe supplied alt text of your assetNo
labelsObjectSupplied key-value pairs associated with the assetNo
tagsArraySupplied attributes associated with the assetNo
urlStringURL source of content. Domain must be allowed within allowed-domains configurationYes

Since there is only JSON in the request, the Content-Type is application/json.

Store Asset Response

Regardless of the upload method used, a successful storage request returns a 201 Created status and the following JSON response representing the asset metadata.

HTTP/1.1 201 CREATED
Content-Type: application/json

{
"class": "image",
"alt": "The alt text for an image",
"entryId": 42,
"labels": {
"label-key": "label-value",
"phone": "Android"
},
"tags": [ "cold", "verified" ],
"source": "url", // or "upload" if using multipart upload
"sourceUrl": "https://yoururl.com/image.jpeg",
"variants": [
{
"isOriginalVariant": true,
"storeBucket": "assets",
"storeKey": "d905170f-defd-47e4-b606-d01993ba7b42",
"attributes": {
"height": 100,
"width": 200,
"format": "jpg"
},
"lqip": {
"blurhash": "BASE64",
"thumbhash": "BASE64"
}
}
],
"createdAt": "2025-11-12T01:20:55"
}

Additionally, a Location header is returned containing an absolute URL to the asset's link return format.

Note: the entryId query selector is supplied so the URL is absolute and can be used for subsequent GET and PUT operations.

Field NameTypeDescription
classStringThe type of the asset, currently always image
altStringThe supplied alt text of your asset
entryIdLongSystem-generated unique identifier of asset within path
labelsObjectSupplied key-value pairs associated with the asset
tagsArraySupplied attributes associated with the asset
sourceStringEither url or upload depending on how you provided asset content
sourceUrlStringIf URL source was used, then this is the supplied URL
variantsAssetVariantWill only contain the original variant - the one supplied
createdAtISO 8601Date asset was stored
modifiedAtISO 8601Date asset was last modified (ignores variant generation)

AssetVariant

Field NameTypeDescription
isOriginalVariantBooleanWhether the variant is the original variant. For store-asset response, this is true.
storeBucketStringThe S3 bucket the asset is stored in - defined in path configuration
storeKeyStringThe key of the asset in the object store
attributesAttributesExtracted attributes of the asset
transformationTransformationNormalized original variant transformation - not returned for original variants
lqipLQIPLow-Quality Image Placeholder (LQIP) values if enabled in path configuration

Attributes

Field NameTypeDescription
heightIntegerHeight of variant
widthIntegerWidth of variant
formatFormatFormat of variant
pageCountIntegerNumber of pages in image (1 unless image is animated)
loopIntegerFor mulit-paged images, specifies the amount of animated repitions. Defaults to 0; -1 is continuous looping

Format

FormatNameFile ExtensionContent Type
pngPNG.pngimage/png
jpgJPEG.jpegimage/jpeg
webpWEBP.webpimage/webp
avifAVIF.avifimage/avif
jxlJPEG XL.jxlimage/jxl
heicHEIC.heicimage/heic
gifGIF.gifimage/gif